package com.mi.system.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mi.system.dto.query.UserQueryDTO;
import com.mi.system.dto.request.UserEnableRequestDTO;
import com.mi.system.dto.request.UserLoginRequestDTO;
import com.mi.system.dto.request.UserModifyPasswordRequestDTO;
import com.mi.system.dto.request.UserRequestDTO;
import com.mi.system.entity.User;
import com.mi.system.vo.UserAuthVO;
import com.mi.system.vo.UserVO;

import java.util.List;

/**
 * User service
 *
 * @author jin_huaquan
 * @version 1.0
 * @date 2021/11/1 13:56
 */
public interface UserService extends IService<User> {

    /**
     * list user
     *
     * @param page  page info
     * @param query query params
     * @return user list
     */
    Page<UserVO> listUser(Page page, UserQueryDTO query);

    /**
     * list user
     *
     * @param query query params
     * @return user list
     */
    List<UserVO> listUser(UserQueryDTO query);

    /**
     * Get current user info
     *
     * @return user info
     */
    UserVO getCurrentUser();

    /**
     * Get user info by username
     *
     * @param username username
     * @return user info
     */
    UserVO getUser(String username);

    /**
     * user login
     *
     * @param request login request
     * @return user info
     */
    UserAuthVO login(UserLoginRequestDTO request);

    /**
     * save user
     *
     * @param request user info
     * @return result
     */
    boolean saveUser(UserRequestDTO request);

    /**
     * update user
     *
     * @param id      user id
     * @param request user info
     * @return result
     */
    boolean updateUser(Long id, UserRequestDTO request);

    /**
     * 管理员修改用户的密码
     *
     * @param id      用户ID
     * @param request 密码信息
     * @return 修改结果
     */
    boolean modifyPassword(Long id, UserModifyPasswordRequestDTO request);

    /**
     * 用户修改账号密码
     *
     * @param request 密码信息
     * @return 修改结果
     */
    boolean modifyPassword(UserModifyPasswordRequestDTO request);

    /**
     * 启用/禁用用户
     *
     * @param id      用户ID
     * @param request 启用/禁用请求
     * @return 是否启用/禁用成功
     */
    boolean enableUser(Long id, UserEnableRequestDTO request);

    /**
     * remove user
     *
     * @param id user id
     * @return result
     */
    User removeUser(Long id);
}
